package com.example.kafka.kerberos.common;

import java.util.Random;
import java.util.UUID;

/**
 * @author stone
 * @version $1.0
 * @date 2020/9/21 10:33:12
 */
public class Krb5Utils {

    public static String uuidKey() {
        return UUID.randomUUID().toString().replaceAll("-","");
    }

    /**
     * 临时文件名生成 randomNum = [1000-9999]
     *
     * @return format 'tmpFileSeq_${randomNum}.keytab'
     */
    public static String tmpFileName() {
        Random random = new Random();
        int seq = random.nextInt((10000) % (10000 - 1000 + 1) + 1000);
        return "tmpFileSeq_" + seq + ".keytab";
    }

}
